<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>    
    <title>Vue基础</title>
</head>
<body>
    <div id="app">
        <a>共{{student.length}}条数据</a>
        <button @click="clear">清空</button>
        <input type="text" v-model="message" @keyup.enter="add">
        <ul>
            <li v-for="(item,index) in student" @dblclick="del(index)">{{item}}</li>
        </ul>
    </div>
    <script>
        var app = new Vue({
            el:"#app",
            data:{
                message:"你好",
                student:["lisa","bob","peter"]
            },
            methods:{
                add:function(){
                    this.student.push(this.message)
                },
                del:function(index){
                    this.student.splice(index,1)
                },
                clear:function(){
                    this.student = []
                }
            }
        })
    </script>
</body>
</html>